<?php include $this->getViewFile('/common/Head') ?>
<body class="J_scroll_fixed">
  <style type="text/css">
    .color{
      color:red;
    }
  </style>

  <div class="wrap J_check_wrap">
    <?php include $this->getViewFile('/common/Nav') ?>


     <!-- 搜索 -->
    <div class="h_a">查找</div>
    <?php $objForm = $this->beginWidget( 'CActiveForm', array('id' => 'searchForm','method' => 'get','action' => $this->createUrl('countproduct')) ); ?>
      <div class="search_type cc mb10">
           <div class="mb10">
        统计时间范围：
        <input type="text" name="add_start_time" class="input length_2 J_date" value="<?php echo $add_start_time?>" placeholder="选择起始时间">
        -
        <input type="text" class="input length_2 J_date" name="add_end_time" value="<?php echo $add_end_time?>" placeholder="选择结束时间">       

        <button class="btn">搜索</button>
          
          </div>
      </div>
    <?php $this->endWidget(); ?>


    <div class="mb10">
      总共<?php echo $count ?>记录
    </div>

    <form name="myform" action="" method="post" class="J_ajaxForm">
      <div class="table_list">
        <table width="100%" cellspacing="0">
          <thead>
            <tr>
              <td width="" align="center">商品ID</td>
              <td width="" align="center">图片</td>
              <td align="center">上架次数</td>
              <td align="center">报名次数</td>
              <td align="center">销售量</td>
              <td align="center">销售额</td>
            </tr>
          </thead>
          <tbody>

             <?php foreach($data as $key => $rs){ ?>
              <tr data-product_id="<?php echo $rs['product_id'] ?>">
                <td  class="product_id" align="center"><?php echo $rs['product_id']; ?></td>
                <td  class="img" align="center"><img width="100" height="100" src="<?php echo $rs['product_img']; ?>" /></td>
                <td  class="sum" align="center"><a href="javascript:void(0)"><?php echo $rs['sum']; ?></a></td>
                <td  class="sum_pass" align="center"><a href="javascript:void(0)"><?php echo $rs['sum_pass']; ?></a></td>
                <td  class="turnover" align="center"><?php echo $rs['turnover']; ?></td>
                <td  class="sales" align="center"><?php echo $rs['sales']; ?></td>                                  
              </tr>
             <?php } ?>

          </tbody>
        </table>
      <div class="p10">
        <div class="pages"><?php echo $Page;?></div>
      </div>
        
      </div>
    </form>


  </div>
  <script src="<?php echo $staticUrl; ?>statics/js/common.js"></script>

  <script type="text/javascript">


  var add_start_time = '<?php echo $add_start_time; ?>';
  var end_start_time = '<?php echo $end_start_time; ?>';

    $(function(){
      $(".sum,.sum_pass").click(function(){
        var obj = $(this);
        var obj_a = obj.find('a').eq(0);
        if(parseInt(obj_a.html()) == 0){
          alert('找不到记录');
          return false;
        }

        var obj_return = {};
        var obj_tr = obj.parents('tr');


        obj_return.product_id = obj_tr.data('product_id');
        //选择了时间范围
        if(parseInt(add_start_time)){
          obj_return.add_start_time = add_start_time;
        }
        if(parseInt(end_start_time)){
          obj_return.end_start_time = end_start_time;
        }        


        if(obj.hasClass('sum_pass')){
          obj_return.status = 1;
        }


        var canshu = '?';
        for(var i in obj_return){
          if(obj_return[i] != ''){
            var value = i+"="+obj_return[i]+"&";
            canshu += value;
          }
        }       

        Wind.use('artDialog','iframeTools', function () {
          var dialog = art.dialog.open('<?php echo $this->createUrl("goodslist") ?>'+canshu,{
            title: '信息列表',
            id: 'notice',
            lock: false,
            fixed: true,
            width:700,
            height:500,
            background: "#CCCCCC",
            cancelDisplay: false,          
          });     
        });
      })      
    })
  </script>

</body>
</html>